package com.heima;

import com.heima.Mapper.AdminAdUserMapper;
import com.heima.model.Admin.Pojos.AdUser;
import com.heima.utils.common.MD5Utils;
import com.heima.utils.common.SaltUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Date;

@SpringBootTest
public class test {
    @Autowired
    AdminAdUserMapper adminAdUserMapper;
    @Test
    public void adduser()
    {
        AdUser adUser=new AdUser();
        adUser.setName("gxy");
        String salt = SaltUtil.GetSalt();
        adUser.setSalt(salt);
        adUser.setPassword(MD5Utils.encodeWithSalt("123",salt));
        adUser.setNickname("gg");
        adUser.setPhone("18720476201");
        adUser.setStatus(1);
        adUser.setEmail("3387519013@qq.com");
        Date date=new Date();
        adUser.setCreatedTime(date);
        adUser.setLoginTime(date);
        adUser.setId(4);
        adminAdUserMapper.insert(adUser);
    }
}
